#-*- coding: utf-8 -*-
#@File    : myshop.PY
#@Time    : 2020/12/16  16:45
#@Software: PyCharm

from lib.config import HOST
from data.LoginTest import Login

import requests
class MyShop:
    #1 需要商铺 需要token
    def __init__(self,inToken):
        self.header = {'Authorization':inToken}  #请求头

    #2 列出商铺
    def shop_list(self,inData):
        payload = inData
        url = f"{HOST}/shopping/myShop"
        resp = requests.get(url,headers = self.header,params=payload)
        return resp.json()

if __name__ == '__main__':

    #登录成功
    token = Login().login({"username":"sq0313","password":"111111"},getToken=True)
    #修改参数
    res = MyShop(token).shop_list({'page':1,'limit':20})
    import pprint
    pprint.pprint(res)
